Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Using Graphics Exporter Components

To export an image to a file or a data reference using a graphics exporter, you must open a graphics exporter component instance, specify the source of the input image and the destination for the output image file, set the parameters you want, and call GraphicsExportDoExport .

You select a particular graphics exporter component based on the desired output format, such as GIF or PNG. If you know which file format you want to write, you can use a call such as OpenADefaultComponent to open the appropriate exporter.

The input image can come from a QuickDraw Picture, a GWorld or PixMap, a QuickTime graphics importer component instance, or a segment of compressed data described by a QuickTime image description. In the last case, the compressed data may be accessed via a pointer, handle, file or other data reference.

The output image for an export operation can be specified as a handle, a file, or a data reference.

When you are done with the graphics exporter component instance, call CloseComponent .

The following example code ( Listing 17-1 ) shows the basic functions you use to export a GWorld to an image file. Error-checking code has been removed.

Listing 1 The basic functions used to export a GWorld to an image file

void writeGWorldToImageFile( GWorldPtr gw, const FSSpec *fileSpec )
{
    GraphicsExportComponent ge = 0;
    
    OpenADefaultComponent( GraphicsExporterComponentType,
                            kQTFileTypePNG, &ge );
    GraphicsExportSetInputGWorld( ge, gw );
    GraphicsExportSetOutputFile( ge, fileSpec );
    GraphicsExportDoExport( ge, nil );
    CloseComponent( ge );
}

Selecting a Graphics Exporter Component

Specifying the Source

Specifying the Destination

Specifying Export Settings

Settings Dialogs

User Interface

File Type and Creator


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |